#ifndef DATABASE_H
#define DATABASE_H

// RakNet includes
#include "RakString.h"
#include "Enums.h"

// My includes
#include "Network.h"

// MySQL Includes
#include "winsock.h"
#include <mysql.h>

// RakNet Namespace
using namespace RakNet;

// MySQL defines
#define DB_HOST "127.0.0.1"
#define DB_USER "root"
#define DB_PASS "4100519"
#define DB_DATABASE "Thermila"

class Server;

class Database
{
public:
	Database();
	~Database();

	// Connect to database
	bool connect();
	// Pointer to server object
	void setServer(Server* svr);
	// Query the database for the user's account
	bool checkAccount(RakString account, RakString password);
	// Retrieve the character list
	void retrieveCharacters(RakString account, Packet *packet);
	// Send character info to client
	void sendCharacters(RakString account, Packet *packet);
	// Delete a character from the database
	void deleteCharacter(Packet *packet);
	// Create a new character
	void createCharacter(Packet *packet);
	// Get all data for a character and send to client
	void getCharacter(Packet *packet);
private:
	// MySQL
	MYSQL *mConnection, mMySQL;
	MYSQL_RES *mResult;
	MYSQL_ROW mRow;
	int mQueryState;

	//Connection conn;
	Server* server;
};

#endif // DATABASE_H